home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / man.3 / CrtMainWin.3 < prev    next >
Text File  |  1995-07-21  |  14KB  |  395 lines

  1. '\"
  2. '\" Copyright (c) 1990 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/CrtMainWin.3,v 1.16 93/10/15 09:37:03 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .\" The definitions below are for supplemental macros used in Tcl/Tk
  24. .\" manual entries.
  25. .\"
  26. .\" .HS name section [date [version]]
  27. .\"    Replacement for .TH in other man pages.  See below for valid
  28. .\"    section names.
  29. .\"
  30. .\" .AP type name in/out [indent]
  31. .\"    Start paragraph describing an argument to a library procedure.
  32. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  33. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  34. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  35. .\"    needed;  use .AS below instead)
  36. .\"
  37. .\" .AS [type [name]]
  38. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  39. .\"    name are examples of largest possible arguments that will be passed
  40. .\"    to .AP later.  If args are omitted, default tab stops are used.
  41. .\"
  42. .\" .BS
  43. .\"    Start box enclosure.  From here until next .BE, everything will be
  44. .\"    enclosed in one large box.
  45. .\"
  46. .\" .BE
  47. .\"    End of box enclosure.
  48. .\"
  49. .\" .VS
  50. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  51. .\"    of man pages.
  52. .\"
  53. .\" .VE
  54. .\"    End of vertical sidebar.
  55. .\"
  56. .\" .DS
  57. .\"    Begin an indented unfilled display.
  58. .\"
  59. .\" .DE
  60. .\"    End of indented unfilled display.
  61. .\"
  62. '\"    # Heading for Tcl/Tk man pages
  63. .de HS
  64. .ds ^3 \\0
  65. .if !"\\$3"" .ds ^3 \\$3
  66. .if '\\$2'cmds'       .TH \\$1 1 \\*(^3 \\$4
  67. .if '\\$2'lib'        .TH \\$1 3 \\*(^3 \\$4
  68. .if '\\$2'tcl'        .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands"
  69. .if '\\$2'tk'         .TH \\$1 n \\*(^3 Tk "Tk Commands"
  70. .if '\\$2'tclc'        .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures"
  71. .if '\\$2'tkc'         .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures"
  72. .if '\\$2'tclcmds'         .TH \\$1 1 \\*(^3 Tk "Tcl Applications"
  73. .if '\\$2'tkcmds'         .TH \\$1 1 \\*(^3 Tk "Tk Applications"
  74. .if t .wh -1.3i ^B
  75. .nr ^l \\n(.l
  76. .ad b
  77. ..
  78. '\"    # Start an argument description
  79. .de AP
  80. .ie !"\\$4"" .TP \\$4
  81. .el \{\
  82. .   ie !"\\$2"" .TP \\n()Cu
  83. .   el          .TP 15
  84. .\}
  85. .ie !"\\$3"" \{\
  86. .ta \\n()Au \\n()Bu
  87. \&\\$1    \\fI\\$2\\fP    (\\$3)
  88. .\".b
  89. .\}
  90. .el \{\
  91. .br
  92. .ie !"\\$2"" \{\
  93. \&\\$1    \\fI\\$2\\fP
  94. .\}
  95. .el \{\
  96. \&\\fI\\$1\\fP
  97. .\}
  98. .\}
  99. ..
  100. '\"    # define tabbing values for .AP
  101. .de AS
  102. .nr )A 10n
  103. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  104. .nr )B \\n()Au+15n
  105. .\"
  106. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  107. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  108. ..
  109. '\"    # BS - start boxed text
  110. '\"    # ^y = starting y location
  111. '\"    # ^b = 1
  112. .de BS
  113. .br
  114. .mk ^y
  115. .nr ^b 1u
  116. .if n .nf
  117. .if n .ti 0
  118. .if n \l'\\n(.lu\(ul'
  119. .if n .fi
  120. ..
  121. '\"    # BE - end boxed text (draw box now)
  122. .de BE
  123. .nf
  124. .ti 0
  125. .mk ^t
  126. .ie n \l'\\n(^lu\(ul'
  127. .el \{\
  128. .\"    Draw four-sided box normally, but don't draw top of
  129. .\"    box if the box started on an earlier page.
  130. .ie !\\n(^b-1 \{\
  131. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  132. .\}
  133. .el \}\
  134. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  135. .\}
  136. .\}
  137. .fi
  138. .br
  139. .nr ^b 0
  140. ..
  141. '\"    # VS - start vertical sidebar
  142. '\"    # ^Y = starting y location
  143. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  144. .de VS
  145. .mk ^Y
  146. .ie n 'mc \s12\(br\s0
  147. .el .nr ^v 1u
  148. ..
  149. '\"    # VE - end of vertical sidebar
  150. .de VE
  151. .ie n 'mc
  152. .el \{\
  153. .ev 2
  154. .nf
  155. .ti 0
  156. .mk ^t
  157. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  158. .sp -1
  159. .fi
  160. .ev
  161. .\}
  162. .nr ^v 0
  163. ..
  164. '\"    # Special macro to handle page bottom:  finish off current
  165. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  166. '\"    # page bottom macro.
  167. .de ^B
  168. .ev 2
  169. 'ti 0
  170. 'nf
  171. .mk ^t
  172. .if \\n(^b \{\
  173. .\"    Draw three-sided box if this is the box's first page,
  174. .\"    draw two sides but no top otherwise.
  175. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  176. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  177. .\}
  178. .if \\n(^v \{\
  179. .nr ^x \\n(^tu+1v-\\n(^Yu
  180. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  181. .\}
  182. .bp
  183. 'fi
  184. .ev
  185. .if \\n(^b \{\
  186. .mk ^y
  187. .nr ^b 2
  188. .\}
  189. .if \\n(^v \{\
  190. .mk ^Y
  191. .\}
  192. ..
  193. '\"    # DS - begin display
  194. .de DS
  195. .RS
  196. .nf
  197. .sp
  198. ..
  199. '\"    # DE - end display
  200. .de DE
  201. .fi
  202. .RE
  203. .sp .5
  204. ..
  205. .HS Tk_CreateMainWindow tkc
  206. .BS
  207. .SH NAME
  208. Tk_CreateMainWindow, Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist \- create or delete window
  209. .SH SYNOPSIS
  210. .nf
  211. \fB#include <tk.h>\fR
  212. .sp
  213. Tk_Window
  214. .VS
  215. \fBTk_CreateMainWindow\fR(\fIinterp, screenName, baseName, className\fR)
  216. .VE
  217. .sp
  218. Tk_Window
  219. \fBTk_CreateWindow\fR(\fIinterp, parent, name, topLevScreen\fR)
  220. .sp
  221. Tk_Window
  222. \fBTk_CreateWindowFromPath\fR(\fIinterp, tkwin, pathName, topLevScreen\fR)
  223. .sp
  224. \fBTk_DestroyWindow\fR(\fItkwin\fR)
  225. .sp
  226. \fBTk_MakeWindowExist\fR(\fItkwin\fR)
  227. .SH ARGUMENTS
  228. .AS Tcl_Interp *topLevScreen
  229. .AP Tcl_Interp *interp out
  230. Tcl interpreter to use for error reporting.  If no error occurs,
  231. then \fI*interp\fR isn't modified.  For \fBTk_CreateMainWindow\fR,
  232. this interpreter is associated permanently with the created window,
  233. and Tk-related commands are bound into the interpreter.
  234. .AP char *screenName in
  235. String name of screen on which to create window.  Has the form
  236. \fIdisplayName\fB.\fIscreenNum\fR, where \fIdisplayName\fR is the
  237. name of a display and \fIscreenNum\fR is a screen number.  If
  238. the dot and \fIscreenNum\fR are omitted, the screen number defaults
  239. to 0.  If \fIscreenName\fR is NULL or empty string, defaults to
  240. contents of DISPLAY environment variable.
  241. .AP char *baseName in
  242. Name to use for this main window.  See below for details.
  243. .AP char *className in
  244. .VS
  245. Class to use for application and for main window.
  246. .VE
  247. .AP Tk_Window parent in
  248. Token for the window that is to serve as the logical parent of
  249. the new window.
  250. .AP char *name in
  251. Name to use for this window.  Must be unique among all children of
  252. the same \fIparent\fR.
  253. .AP char *topLevScreen in
  254. Has same format as \fIscreenName\fR.  If NULL, then new window is
  255. created as an internal window.  If non-NULL, new window is created as
  256. a top-level window on screen \fItopLevScreen\fR.  If \fItopLevScreen\fR
  257. is an empty string (``'') then new
  258. window is created as top-level window of \fIparent\fR's screen.
  259. .AP Tk_Window tkwin in
  260. Token for window.
  261. .AP char *pathName in
  262. Name of new window, specified as path name within application
  263. (e.g. \fB.a.b.c\fR).
  264. .BE
  265.  
  266. .SH DESCRIPTION
  267. .PP
  268. The three procedures \fBTk_CreateMainWindow\fR, \fBTk_CreateWindow\fR,
  269. and \fBTk_CreateWindowFromPath\fR are used to create new windows for
  270. use in Tk-based applications.  Each of the procedures returns a token
  271. that can be used to manipulate the window in other calls to the Tk
  272. library.  If the window couldn't be created successfully, then NULL
  273. is returned and \fIinterp->result\fR is modified to hold an error
  274. message.
  275. .PP
  276. Tk supports three different kinds of windows:  main windows, internal
  277. windows, and top-level windows.
  278. A main window is the outermost window corresponding to an application.
  279. Main windows correspond to the independent units of an application,
  280. such as a view on a file that is part of an editor, or a clock, or
  281. a terminal emulator.  A main window is created as a child of the root
  282. window of the screen indicated by the \fIscreenName\fR.  Each main
  283. window, and all its descendants, are typically associated with a
  284. single Tcl command interpreter.
  285. An internal window is an interior window of a Tk application, such as a
  286. scrollbar or menu bar or button.  A top-level window is one that is
  287. created as a child of a screen's root window, rather than as an
  288. interior window, but which is logically part of some existing main
  289. window.  Examples of top-level windows are pop-up menus and dialog boxes.
  290. .PP
  291. \fBTk_CreateMainWindow\fR creates a new main window and associates
  292. .VS
  293. its \fIinterp\fR argument with that window and all its eventual
  294. descendants.
  295. \fBTk_CreateMainWindow\fR also carries out several other actions to
  296. set up the new application.
  297. First, it adds all the Tk commands to those already defined
  298. for \fIinterp\fR.
  299. Second, it turns the new window into a \fBtoplevel\fR widget, which
  300. will cause the X window to be created and mapped as soon as the
  301. application goes idle.
  302. Third, \fBTk_CreateMainWindow\fR registers \fIinterp\fR so that it
  303. .VE
  304. can be accessed remotely by other Tk applications using the \fBsend\fR
  305. command and the name \fIbaseName\fR.  Normally, \fIbaseName\fR consists
  306. of the name of the application followed by a space and an identifier for this
  307. particular main window (if such an identifier is relevant).  For example,
  308. an editor named \fBmx\fR displaying the file \fBfoo.c\fR would use
  309. ``mx foo.c'' as the basename.  An application that doesn't usually
  310. have multiple instances, such as a clock program, would just use the
  311. name of the application, e.g. ``xclock''.  If \fIbaseName\fR is already
  312. in use by some other registered interpreter, then \fBTk_CreateMainWindow\fR
  313. extends \fIbaseName\fR with a number to produce a unique name like
  314. ``mx foo.c #2'' or ``xclock #12''.  This name is used both as the name
  315. of the window (returned by \fBTk_Name\fR) and as the registered name
  316. of the interpreter.
  317. .VS
  318. Fourth, \fBTk_CreateMainWindow\fR sets \fIclassName\fR as the class of
  319. the application (among other things, this is used for lookups in
  320. the option database), and also as the class of the main widget.
  321. .VE
  322. .PP
  323. Either internal or top-level windows may be created by calling
  324. \fBTk_CreateWindow\fR.  If the \fItopLevScreen\fR argument is
  325. NULL, then the new window will be an internal window.  If
  326. \fItopLevScreen\fR is non-NULL, then the new window will be a
  327. top-level window: \fItopLevScreen\fR indicates the name of
  328. a screen and the new window will be created as a child of the
  329. root window of \fItopLevScreen\fR.  In either case Tk will
  330. consider the new window to be the logical child of \fIparent\fR:
  331. the new window's path name will reflect this fact, options may
  332. be specified for the new window under this assumption, and so on.
  333. The only difference is that new X window for a top-level window
  334. will not be a child of \fIparent\fR's X window.  For example, a pull-down
  335. menu's \fIparent\fR would be the button-like window used to invoke it,
  336. which would in turn be a child of the menu bar window.  A dialog box might
  337. have the application's main window as its parent.  This approach
  338. means that all the windows of an application fall into a hierarchical
  339. arrangement with a single logical root:  the application's main window.
  340. .PP
  341. \fBTk_CreateWindowFromPath\fR offers an alternate way of specifying
  342. new windows.  In \fBTk_CreateWindowFromPath\fR the new
  343. window is specified with a token for any window in the target
  344. application (\fItkwin\fR), plus a path name for the new window.
  345. It produces the same effect as \fBTk_CreateWindow\fR and allows
  346. both top-level and internal windows to be created, depending on
  347. the value of \fItopLevScreen\fR.  In calls to \fBTk_CreateWindowFromPath\fR,
  348. as in calls to \fBTk_CreateWindow\fR, the parent of the new window
  349. must exist at the time of the call, but the new window must not
  350. already exist.
  351. .PP
  352. In truth, the window-creation procedures don't
  353. actually issue the command to X to create a window.
  354. Instead, they create a local data structure associated with
  355. the window and defer the creation of the X window.
  356. The window will actually be created by the first call to
  357. \fBTk_MapWindow\fR.  Deferred window creation allows various
  358. aspects of the window (such as its size, background color,
  359. etc.) to be modified after its creation without incurring
  360. any overhead in the X server.  When the window is finally
  361. mapped all of the window attributes can be set while creating
  362. the window.
  363. .PP
  364. The value returned by a window-creation procedure is not the
  365. X token for the window (it can't be, since X hasn't been
  366. asked to create the window yet).  Instead, it is a token
  367. for Tk's local data structure for the window.  Most
  368. of the Tk library procedures take Tk_Window tokens, rather
  369. than X identifiers.  The actual
  370. X window identifier can be retrieved from the local
  371. data structure using the \fBTk_WindowId\fR macro;  see
  372. the manual entry for \fBTk_WindowId\fR for details.
  373. .PP
  374. \fBTk_DestroyWindow\fR deletes a window and all the data
  375. strutures associated with it, including any event handlers
  376. created with \fBTk_CreateEventHandler\fR.  In addition,
  377. \fBTk_DestroyWindow\fR will delete any children of \fItkwin\fR
  378. recursively (where children are defined in the Tk sense, consisting
  379. of all windows that were created with the given window as \fIparent\fR).
  380. If \fItkwin\fR was created by \fBTk_CreateInternalWindow\fR then event
  381. handlers interested in destroy events
  382. are invoked immediately.  If \fItkwin\fR is a top-level or main window,
  383. then the event handlers will be invoked later, after X has seen
  384. the request and returned an event for it.
  385. .PP
  386. If a window has been created
  387. but hasn't been mapped, so no X window exists, it is
  388. possible to force the creation of the X window by
  389. calling \fBTk_MakeWindowExist\fR.  This procedure issues
  390. the X commands to instantiate the window given by \fItkwin\fR.
  391.  
  392. .SH KEYWORDS
  393. create, deferred creation, destroy, display, internal window, main window,
  394. register, screen, top-level window, window
  395.